//
//  geocodeModel.m
//  RouteSearcher
//
//  Created by wenqingzhou on 2/15/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "GeocodeModel.h"


@implementation geocodeModel

@synthesize name,number,city,code,address,type,category,xcode,ycode,lon,lat;

+(geocodeModel *)initWithAtrributes:(NSDictionary *)attributes
{
	geocodeModel *oneGeocode = [[geocodeModel alloc] init];
	oneGeocode.name =[attributes objectForKey:@"name1"];
	oneGeocode.number = [attributes objectForKey:@"number"];
	oneGeocode.city =  [attributes objectForKey:@"city"];
	oneGeocode.code = [attributes objectForKey:@"code"];
	oneGeocode.address= [attributes objectForKey:@"address"];
	oneGeocode.type= [attributes objectForKey:@"type"];
	oneGeocode.category= [attributes objectForKey:@"category"];
	oneGeocode.xcode= [attributes objectForKey:@"x"];	
	oneGeocode.ycode= [attributes objectForKey:@"y"];
	oneGeocode.lon= [attributes objectForKey:@"lon"];
	oneGeocode.lat= [attributes objectForKey:@"lat"];
	return [oneGeocode autorelease]; 
}
-(NSString *)formattedAddressFromGeocode
{
	NSString *rs=[[self.name stringByAppendingFormat:@" "] 
					stringByAppendingFormat:@" %@,%@",self.number,self.city]; 
	NSLog(@"%@",rs);
	return 	rs;
}
-(void)dealloc
{
	[name release];
	[number release];
	[city release];
	[code release];
	[address release];
	[type release];
	[category release];
	[xcode release];	
	[ycode release];
	[lon release];
	[lat release] ;
	[super dealloc];
}
@end
